package orm

import (
	"embed"
	"go-quick/interface/ilogger"
	"go-quick/interface/iorm"
	"sync"
	"time"
)

type Config struct {
	// GORM perform single create, update, delete operations in transactions by default to ensure database data integrity
	// You can disable it by setting `SkipDefaultTransaction` to true
	SkipDefaultTransaction bool
	// NamingStrategy tables, columns naming strategy
	//NamingStrategy schema.Namer
	// FullSaveAssociations full save associations
	FullSaveAssociations bool
	// Logger
	Logger ilogger.ILogger
	// NowFunc the function to be used when creating a new timestamp
	NowFunc func() time.Time
	// DryRun generate sql without execute
	DryRun bool
	// PrepareStmt executes the given query in cached statement
	PrepareStmt bool
	// DisableAutomaticPing
	DisableAutomaticPing bool
	// DisableForeignKeyConstraintWhenMigrating
	DisableForeignKeyConstraintWhenMigrating bool
	// IgnoreRelationshipsWhenMigrating
	IgnoreRelationshipsWhenMigrating bool
	// DisableNestedTransaction disable nested transaction
	DisableNestedTransaction bool
	// AllowGlobalUpdate allow global update
	AllowGlobalUpdate bool
	// QueryFields executes the SQL query with all fields of the table
	QueryFields bool
	// CreateBatchSize default create batch size
	CreateBatchSize int
	// TranslateError enabling error translation
	TranslateError bool
	// ConnPool db conn pool
	ConnPool iorm.IConnPool
	// Dialector database dialector
	iorm.IDialector
	// Plugins registered plugins
	Plugins map[string]iorm.IPlugin

	cacheStore *sync.Map
	MapperFs   embed.FS

	SlowThreshold             time.Duration // 慢SQL阈值
	IgnoreRecordNotFoundError bool          // 是否忽略记录没有找到错误
}
